//
//  MAZhuanShuCell.m
//  meiang_edu
//
//  Created by hfcb on 2018/9/29.
//  Copyright © 2018年 com.meiang.meiang_edu. All rights reserved.
//

#import "MAZhuanShuCell.h"
#import "MAZhuanShuServiceModel.h"

#define ZhuanShuCell @"ZhuanShuCell"

@interface MAZhuanShuCell ()
@property (weak, nonatomic) IBOutlet UIView *containerView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@end

@implementation MAZhuanShuCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.containerView.layer.cornerRadius = 4;
    self.containerView.layer.masksToBounds = YES;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] lastObject];
    }
    return self;
}

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    
    MAZhuanShuCell *cell = [tableView dequeueReusableCellWithIdentifier:ZhuanShuCell];
    if (cell == nil) {
        cell = [[MAZhuanShuCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ZhuanShuCell];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (void)setMsgModel:(MAZhuanShuServiceModel *)msgModel {
    _msgModel = msgModel;
    self.titleLabel.text = msgModel.message_title;
    self.contentLabel.text = msgModel.message_content;
    self.timeLabel.text = msgModel.send_time;
    CGFloat contentH = [msgModel.message_content sizeWithLabelWidth:SCREEN_WIDTH - 32 font:Font(FONT_SIZE_14)].height;
    msgModel.cellHeight = 12 + 17 + 10 + contentH + 10 + 14.5 + 10 + 4;
}
@end
